﻿/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-10-24 18:59:28
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-10-25 09:31:08
 * @FilePath: \WYW_0419_Oasis\JavaScripts\WuQi.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
@MWCore.MWClass
export default class WuQi extends MWCore.MWScript {

	/** 当脚本被实例后，会在第一帧更新前调用此函数 */
	protected onStart(): void{
		let trigger=this.gameObject as GamePlay.Trigger

		trigger.onEnter.add(this.OnTriggerEnter.bind(this))
	}

	private OnTriggerEnter(other:MWCore.GameObject)
	{
		if(GamePlay.isCharacter(other))
		{
		let character=other as GamePlay.Character

		Events.dispatchToClient(character.player,"Wuqi")
			
		let Giguang=this.gameObject.getChildByName("Giguang")

		let guang=this.gameObject.getChildByName("guang")
			setTimeout(()=>
			{
			Giguang.destroy()
			setTimeout(()=>{
				guang.destroy()
			},1000)
			},2000) 
		}
	}

	/** 
	 * 每帧被执行,与上一帧的延迟 dt 秒
	 * 此函数执行需要将this.bUseUpdate赋值为true
	 */
	protected onUpdate(dt: number): void {

	}

	/** 脚本被销毁时最后一帧执行完调用此函数 */
	protected onDestroy(): void {

	}

}
